//
//  SportDetailCell.m
//  ChatOnLine
//
//  Created by dllo on 16/8/15.
//  Copyright © 2016年 WWT. All rights reserved.
//

#import "SportDetailCell.h"

@interface SportDetailCell ()

/** 跑步距离 */
@property (nonatomic, strong) UILabel *distanceLable;
/** 时间 */
@property (nonatomic, strong) UILabel *timeLable;
/** 图片 */
@property (nonatomic, strong) UIImageView *picView;

@end

@implementation SportDetailCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        [self createView];
        
    }
    return self;
}

- (void)createView
{
    self.distanceLable = [[UILabel alloc]init];
    [self.contentView addSubview:self.distanceLable];

    self.timeLable = [[UILabel alloc]init];
    [self.contentView addSubview:self.timeLable];
    
    self.picView = [[UIImageView alloc]init];
    [self.contentView addSubview:self.picView];
    
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    
    [self.distanceLable mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(0);
        make.left.mas_equalTo(10);
        make.size.mas_equalTo(CGSizeMake(SCREEN_WIDTH / 2 - 10, 40));
    }];
    
    [self.timeLable mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(0);
        make.right.mas_equalTo(-10);
        make.size.mas_equalTo(CGSizeMake(SCREEN_WIDTH / 2 - 10, 40));
    }];
   
    [self.picView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(0);
        make.left.mas_equalTo(10);
        make.size.mas_equalTo(CGSizeMake(SCREEN_WIDTH, SCREEN_HEIGHT / 3));
    }];
}


- (void)setDetailArray:(NSArray *)detailArray
{
    _detailArray = detailArray;
    
    self.distanceLable = detailArray[1];
    
    self.timeLable = detailArray[0];
    
    NSString *fullPath = [kRunMap stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.png",detailArray[0]]];
    self.picView.image = [[UIImage alloc] initWithContentsOfFile:fullPath];
    
}









@end
